package com.ss.project.xia17user.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ss.project.xia17user.dao.entity.Client;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

/**
 * oauth2 客户端
 * @author xia17
 * @since 2020/9/15 22:04
 */
@Component
public interface ClientMapper extends BaseMapper<Client> {


    /**
     * 查询用户是否有client的访问权限
     * @param clientId /
     * @param userId /
     * @return /
     */
    @Select("SELECT count(*) FROM sys_user_client WHERE user_id=#{userId} AND client_id = #{clientId}")
    int countUserClientByClientIdAndUserId(String clientId , Long userId);

}
